package com.jeespring.elasticsearch.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;

/**
 * @description UserDao
 * @author 张朝阳
 * @date 2021/2/15 23:21
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(indexName = "user")
public class UserIndexDTO implements Serializable {
    /**
     * 会员编码
     */
    @Id
    @Field(index = true, store = true, type = FieldType.Keyword)
    private Long userCode;

    /**
     * 会员账号
     */
    @Field(index = true, store = true, type = FieldType.Text, analyzer = "standard")
    private String userAccount;

    /**
     * 会员名称
     */
    @Field(index = true, store = true, type = FieldType.Text, analyzer = "ik_smart")
    private String userName;

    /**
     * 会员昵称
     */
    @Field(index = true, store = true, type = FieldType.Text, analyzer = "ik_smart")
    private String userNickName;

    /**
     * 上级机构编码
     */
    @Field(index = true, store = true, type = FieldType.Keyword)
    private String orgCode;

    /**
     * 顶层机构编码
     */
    @Field(index = true, store = true, type = FieldType.Keyword)
    private String topOrgCode;

    /**
     * 用户类型(0企业1个人)
     */
    @Field(index = true, store = true, type = FieldType.Keyword)
    private Integer userType;

    /**
     * 用户层级
     */
    @Field(index = true, store = true, type = FieldType.Keyword)
    private Integer level;

    /**
     * 手机号
     */
    @Field(index = true, store = true, type = FieldType.Keyword)
    private String userTel;

    /**
     * 邮箱
     */
    @Field(index = true, store = true, type = FieldType.Keyword)
    private String userMail;

    /**
     * 位置
     */
    @Field(index = true, store = true, type = FieldType.Keyword)
    private String position;

    /**
     * 创建时间
     */
    @Field(index = false, store = true, type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd")
    private Date createTime;

    /**
     * 更新时间
     */
    @Field(index = false, store = true, type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd")
    private Date updateTime;
}
